*Use Kemahlioglu&Sayari PUCH 2017 replication_individual level analysis
*Table 1
cd C:\data
probit switchindv2 partyvoteshare2 electiontiming timingsqrt right4 left5 incumbent coalneed2 inccoal komisyon dm mayor1 popmil gdpcap, cluster (legislatorid) 
outreg2 using tablerev, bdec(3) excel replace label 
probit faction5 partyvoteshare2 electiontiming timingsqrt right4 left5 incumbent coalneed2 inccoal komisyon cabinet dm mayor1 popmil gdpcap, cluster (legislatorid) 
outreg2 using tablerev, bdec(3) excel append label  
probit switchindv2 partyvoteshare2 electiontiming timingsqrt abspolicypos incumbent coalneed2 inccoal komisyon dm mayor1 popmil gdpcap, cluster (legislatorid) 
outreg2 using tablerev, bdec(3) excel append label 
probit faction5 partyvoteshare2 electiontiming timingsqrt abspolicypos incumbent coalneed2 inccoal komisyon cabinet dm mayor1 popmil gdpcap, cluster (legislatorid) 
outreg2 using tablerev, bdec(3) excel append label 
probit indswitchannual partyvoteshare2 electionannual right4 left5 incumbentannual coalneedannual inccoalannual komisyonannual dm mayorannual popmil gdpcap if annual==1, cluster (legislatorid) 
outreg2 using tablerev, bdec(3) excel append label 
probit factionannual partyvoteshare2 electionannual right4 left5 incumbentannual coalneedannual inccoalannual komisyonannual cabinetannual dm mayorannual popmil gdpcap, cluster (legislatorid) 
outreg2 using tablerev, bdec(3) excel append label 


*Figures 1 & 2
probit switchindv2 partyvoteshare2 electiontiming timingsqrt right4 left5 incumbent coalneed2 inccoal komisyon dm mayor1 popmil gdpcap, cluster (legislatorid) 
mgen, at(partyvoteshare2=(0(0.01)0.7) right4=0 left5=0 komisyon=0 incumbent=1 coalneed2=9.8 inccoal=9.8 mayor1=0) atmeans stub(w0)
mgen, at(partyvoteshare2=(0(0.01)0.7) right4=1 left5=0 komisyon=0 incumbent=1 coalneed2=9.8 inccoal=9.8 mayor1=0) atmeans stub(w1)
twoway connected w0pr1 w1pr1 w0partyvoteshare2   

probit faction5 partyvoteshare2 electiontiming timingsqrt right4 left5 incumbent coalneed2 inccoal komisyon cabinet dm mayor1 popmil gdpcap, cluster (legislatorid) 
mgen, at(partyvoteshare2=(0(0.01)0.7) right4=0 left5=0 komisyon=0 incumbent=1 coalneed2=9.8 inccoal=9.8 mayor1=0) atmeans stub(w2)
mgen, at(partyvoteshare2=(0(0.01)0.7) right4=1 left5=0 komisyon=0 incumbent=1 coalneed2=9.8 inccoal=9.8 mayor1=0) atmeans stub(w3)
twoway connected w2pr1 w3pr1 w2partyvoteshare2   


*Online Appendix
*Descriptive Statistics 
sum switchindv2 faction5 partyvoteshare2 dm dmsqrt mayor1 electiontiming timingsqrt right4 left5 komisyon coalneed2 cabinet incumbent inccoal popmil gdpcap if gdpcap~=. & switch7~=. & komisyon~=. & popmil~=. & partyvoteshare2~=.
sum indswitchannual factionannual partyvoteshare2 electionannual right4 left5 incumbentannual coalneedannual inccoalannual komisyonannual dm mayorannual popmil gdpcap if annual==1 & partyvoteshare2~=. & gdpcap~=. & indswitchannual~=.


*Footnotes
*4 - Splines
btscs switchindv2 monthid legislatorid, g(indnoswitchyrs)nspline(3)
rename _spline1 indspline1
rename _spline2 indspline2
rename _spline3 indspline3
btscs faction5 monthid legislatorid, g(facnoswitchyrs)nspline(3)
rename _spline1 facspline1
rename _spline2 facspline2
rename _spline3 facspline3

probit switchindv2 partyvoteshare2 electiontiming timingsqrt right4 left5 incumbent coalneed2 inccoal komisyon dm mayor1 popmil gdpcap indspline1 indspline2 indspline3, cluster (legislatorid) 
outreg2 using tablerev, bdec(3) excel replace label 
probit faction5 partyvoteshare2 electiontiming timingsqrt right4 left5 incumbent coalneed2 inccoal komisyon cabinet dm mayor1 popmil gdpcap facspline1 facspline2 facspline3, cluster (legislatorid) 
outreg2 using tablerev, bdec(3) excel append label 
probit switchindv2 partyvoteshare2 electiontiming timingsqrt abspolicypos incumbent coalneed2 inccoal komisyon dm mayor1 popmil gdpcap indspline1 indspline2 indspline3, cluster (legislatorid)  
outreg2 using tablerev, bdec(3) excel append label 
probit faction5 partyvoteshare2 electiontiming timingsqrt abspolicypos incumbent coalneed2 inccoal komisyon cabinet dm mayor1 popmil gdpcap facspline1 facspline2 facspline3, cluster (legislatorid)
outreg2 using tablerev, bdec(3) excel append label 


*8 - Factions of 4 and 5
probit factionof4 partyvoteshare2 electiontiming timingsqrt right4 left5 incumbent coalneed2 inccoal komisyon cabinet dm mayor1 popmil gdpcap, cluster (legislatorid) 
outreg2 using tablerev, bdec(3) excel replace label 
probit factionof4 partyvoteshare2 electiontiming timingsqrt abspolicypos incumbent coalneed2 inccoal komisyon cabinet dm mayor1 popmil gdpcap, cluster (legislatorid) 
outreg2 using tablerev, bdec(3) excel append label 
probit factionannualof4 partyvoteshare2 electionannual right4 left5 incumbentannual coalneedannual inccoalannual komisyonannual cabinetannual dm mayorannual popmil gdpcap, cluster (legislatorid) 
outreg2 using tablerev, bdec(3) excel append label 

probit factionof5 partyvoteshare2 electiontiming timingsqrt right4 left5 incumbent coalneed2 inccoal komisyon dm mayor1 popmil gdpcap, cluster (legislatorid) 
outreg2 using tablerev, bdec(3) excel replace label 
probit factionof5 partyvoteshare2 electiontiming timingsqrt abspolicypos incumbent coalneed2 inccoal komisyon dm mayor1 popmil gdpcap, cluster (legislatorid) 
outreg2 using tablerev, bdec(3) excel append label 
probit factionannualof5 partyvoteshare2 electionannual right4 left5 incumbentannual coalneedannual inccoalannual komisyonannual cabinetannual dm mayorannual popmil gdpcap, cluster (legislatorid) 
outreg2 using tablerev, bdec(3) excel append label 


*9 - Rare events logit  
relogit switchindv2 partyvoteshare2 electiontiming timingsqrt right4 left5 incumbent coalneed2 inccoal komisyon dm mayor1 popmil gdpcap, cluster (legislatorid) 
outreg2 using tablerev, bdec(3) excel replace label 
relogit faction5 partyvoteshare2 electiontiming timingsqrt right4 left5 incumbent coalneed2 inccoal komisyon cabinet dm mayor1 popmil gdpcap, cluster (legislatorid) 
outreg2 using tablerev, bdec(3) excel append label 
relogit switchindv2 partyvoteshare2 electiontiming timingsqrt abspolicypos incumbent coalneed2 inccoal komisyon dm mayor1 popmil gdpcap, cluster (legislatorid) 
outreg2 using tablerev, bdec(3) excel append label 
relogit faction5 partyvoteshare2 electiontiming timingsqrt abspolicypos incumbent coalneed2 inccoal komisyon cabinet dm mayor1 popmil gdpcap, cluster (legislatorid) 
outreg2 using tablerev, bdec(3) excel append label 
relogit indswitchannual partyvoteshare2 electionannual right4 left5 incumbentannual coalneedannual inccoalannual komisyonannual dm mayorannual popmil gdpcap if annual==1, cluster (legislatorid) 
outreg2 using tablerev, bdec(3) excel append label 
relogit factionannual partyvoteshare2 electionannual right4 left5 incumbentannual coalneedannual inccoalannual komisyonannual cabinetannual dm mayorannual popmil gdpcap, cluster (legislatorid) 
outreg2 using tablerev, bdec(3) excel append label 


*14 - Including position on the list and quota candidate
probit switchindv2 partyvoteshare2 electiontiming timingsqrt right4 left5 incumbent coalneed2 inccoal komisyon dm mayor1 popmil gdpcap placement kontenjan, cluster (legislatorid) 
outreg2 using tablerev, bdec(3) excel replace label 
probit faction5 partyvoteshare2 electiontiming timingsqrt right4 left5 incumbent coalneed2 inccoal komisyon cabinet dm mayor1 popmil gdpcap placement kontenjan, cluster (legislatorid) 
outreg2 using tablerev, bdec(3) excel append label 

*19 - Multinomial logit
generate switch3way3=switchindv2
replace switch3way3=2 if faction5==1
mlogit switch3way3 partyvoteshare2 electiontiming timingsqrt right4 left5 incumbent coalneed2 inccoal komisyon dm mayor1 popmil gdpcap,  baseoutcome(0) cluster (legislatorid) 
outreg2 using tablefn21, bdec(2) excel replace label 
 
*20 - Excluding large factional split in 2002
probit faction5 partyvoteshare2 electiontiming timingsqrt right4 left5 incumbent coalneed2 inccoal komisyon cabinet dm mayor1 popmil gdpcap if dspytp~=1, cluster (legislatorid) 
 
*21 - Controlling for Constitutional change and political and economic instability
*Constitutional change in 1995
gen lngdpcap=ln(gdpcap)
probit switchindv2 partyvoteshare2 electiontiming timingsqrt right4 left5 incumbent coalneed2 inccoal komisyon dm mayor1 popmil gdpcap conschange, cluster (legislatorid)
outreg2 using tablerev, bdec(3) excel replace label 
probit faction5 partyvoteshare2 electiontiming timingsqrt right4 left5 incumbent coalneed2 inccoal komisyon cabinet dm mayor1 popmil lngdpcap conschange, cluster (legislatorid)
outreg2 using tablerev, bdec(3) excel append label 
  
*1994 and 2001 devaluations/ 1997 military intervention_one month
gen crises=1 if monthid==31
replace crises=1 if monthid==113
replace crises=1 if monthid==65
replace crises=0 if crises~=1
*1994 and 2001 devaluations/ 1997 military intervention_3 months before after
gen crises2=1 if monthid>=28 & monthid<=34
replace crises2=1 if monthid>=110 & monthid<=116
replace crises2=1 if monthid>=62 & monthid<=68
replace crises2=0 if crises2~=1
*1994 and 2001 devaluations/ 1997 military intervention_6 months before after
gen crises3=1 if monthid>=25 & monthid<=37
replace crises3=1 if monthid>=107 & monthid<=119
replace crises3=1 if monthid>=59 & monthid<=71
replace crises3=0 if crises3~=1

*1994 and 2001 devaluations_one month
gen crises4=1 if monthid==31
replace crises4=1 if monthid==113
replace crises4=0 if crises4~=1
*1994 and 2001 devaluations_3 months before after
gen crises5=1 if monthid>=28 & monthid<=34
replace crises5=1 if monthid>=110 & monthid<=116
replace crises5=0 if crises5~=1
*1994 and 2001 devaluations_6 months before after
gen crises6=1 if monthid>=25 & monthid<=37
replace crises6=1 if monthid>=107 & monthid<=119
replace crises6=0 if crises6~=1

cd C:\data
probit switchindv2 partyvoteshare2 electiontiming timingsqrt right4 left5 incumbent coalneed2 inccoal komisyon dm mayor1 popmil gdpcap crises, cluster (legislatorid) 
outreg2 using tablerev, bdec(3) excel replace label 
probit faction5 partyvoteshare2 electiontiming timingsqrt right4 left5 incumbent coalneed2 inccoal komisyon cabinet dm mayor1 popmil gdpcap, cluster (legislatorid) 
outreg2 using tablerev, bdec(3) excel append label 
probit switchindv2 partyvoteshare2 electiontiming timingsqrt right4 left5 incumbent coalneed2 inccoal komisyon dm mayor1 popmil gdpcap crises2, cluster (legislatorid) 
outreg2 using tablerev, bdec(3) excel append label 
probit faction5 partyvoteshare2 electiontiming timingsqrt right4 left5 incumbent coalneed2 inccoal komisyon cabinet dm mayor1 popmil gdpcap crises2, cluster (legislatorid) 
outreg2 using tablerev, bdec(3) excel append label 
probit switchindv2 partyvoteshare2 electiontiming timingsqrt right4 left5 incumbent coalneed2 inccoal komisyon dm mayor1 popmil gdpcap crises3, cluster (legislatorid) 
outreg2 using tablerev, bdec(3) excel append label 
probit faction5 partyvoteshare2 electiontiming timingsqrt right4 left5 incumbent coalneed2 inccoal komisyon cabinet dm mayor1 popmil gdpcap crises3, cluster (legislatorid) 
outreg2 using tablerev, bdec(3) excel append label 

probit switchindv2 partyvoteshare2 electiontiming timingsqrt right4 left5 incumbent coalneed2 inccoal komisyon dm mayor1 popmil gdpcap crises4, cluster (legislatorid) 
outreg2 using tablerev, bdec(3) excel replace label 
probit faction5 partyvoteshare2 electiontiming timingsqrt right4 left5 incumbent coalneed2 inccoal komisyon cabinet dm mayor1 popmil gdpcap, cluster (legislatorid) 
outreg2 using tablerev, bdec(3) excel append label 
probit switchindv2 partyvoteshare2 electiontiming timingsqrt right4 left5 incumbent coalneed2 inccoal komisyon dm mayor1 popmil gdpcap crises5, cluster (legislatorid) 
outreg2 using tablerev, bdec(3) excel append label 
probit faction5 partyvoteshare2 electiontiming timingsqrt right4 left5 incumbent coalneed2 inccoal komisyon cabinet dm mayor1 popmil gdpcap crises5, cluster (legislatorid) 
outreg2 using tablerev, bdec(3) excel append label 
probit switchindv2 partyvoteshare2 electiontiming timingsqrt right4 left5 incumbent coalneed2 inccoal komisyon dm mayor1 popmil gdpcap crises6, cluster (legislatorid) 
outreg2 using tablerev, bdec(3) excel append label 
probit faction5 partyvoteshare2 electiontiming timingsqrt right4 left5 incumbent coalneed2 inccoal komisyon cabinet dm mayor1 popmil gdpcap crises6, cluster (legislatorid) 
outreg2 using tablerev, bdec(3) excel append label 

  

  

